package service;

import dao.RoleMapper;
import pojo.po.Role;
import pojo.vo.Result;
import utils.SqlSessionUtil;

import java.util.List;

public class RoleServiceImpl implements RoleService{
    public Result findAllRoles(){
        Result result = new Result();
        RoleMapper mapper = SqlSessionUtil.getSession().getMapper(RoleMapper.class);
        List<Role> allRolesName = mapper.findAllRolesName();
        if(allRolesName!=null){
            result.setFlag(true);
            result.setData(allRolesName);
        }else {
            result.setFlag(false);
            result.setMsg("数据库中无角色信息，请及时更正");
        }
        return result;
    }
}
